From 41ae0386db0d7e7d235bf399cab7058b1cd71d30 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 21 Mar 2008 21:34:22 +0000 Subject: [PATCH] * (bug 1953) Search form now honors namespace selections more reliably --- RELEASE-NOTES | 2 ++ includes/SpecialSearch.php | 13 ++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 114326f418..00b7c922f4 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -113,6 +113,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Disallow deletion of big pages by means of moving a page to its title and using the "delete and move" option. * (bug 13466) White space differences not shown in diffs +* (bug 1953) Search form now honors namespace selections more reliably + === API changes in 1.13 === diff --git a/includes/SpecialSearch.php b/includes/SpecialSearch.php index 1d6e2a6a7a..885a81abab 100644 --- a/includes/SpecialSearch.php +++ b/includes/SpecialSearch.php @@ -58,9 +58,8 @@ class SpecialSearch { function SpecialSearch( &$request, &$user ) { list( $this->limit, $this->offset ) = $request->getLimitOffset( 20, 'searchlimit' ); - if( $request->getCheck( 'searchx' ) ) { - $this->namespaces = $this->powerSearch( $request ); - } else { + $this->namespaces = $this->powerSearch( $request ); + if( empty( $this->namespaces ) ) { $this->namespaces = $this->userNamespaces( $user ); } @@ -287,7 +286,6 @@ class SpecialSearch { $opt['ns' . $n] = 1; } $opt['redirs'] = $this->searchRedirects ? 1 : 0; - $opt['searchx'] = 1; return $opt; } @@ -479,7 +477,7 @@ class SpecialSearch { $redirect = Xml::check( 'redirs', $this->searchRedirects, array( 'value' => '1' ) ); $searchField = Xml::input( 'search', 50, $term, array( 'type' => 'text', 'id' => 'powerSearchText' ) ); - $searchButton = Xml::submitButton( wfMsg( 'powersearch' ), array( 'name' => 'searchx' ) ) . "\n"; + $searchButton = Xml::submitButton( wfMsg( 'powersearch' ), array( 'name' => 'fulltext' ) ) . "\n"; $out = Xml::openElement( 'form', array( 'id' => 'powersearch', 'method' => 'get', 'action' => $wgScript ) ) . Xml::openElement( 'fieldset' ) . @@ -511,6 +509,11 @@ class SpecialSearch { )); $out .= Xml::hidden( 'title', 'Special:Search' ); $out .= Xml::input( 'search', 50, $term ) . ' '; + foreach( SearchEngine::searchableNamespaces() as $ns => $name ) { + if( in_array( $ns, $this->namespaces ) ) { + $out .= Xml::hidden( "ns{$ns}", '1' ); + } + } $out .= Xml::submitButton( wfMsg( 'searchbutton' ), array( 'name' => 'fulltext' ) ); $out .= Xml::closeElement( 'form' ); -- 2.20.1